<template>
  <div class="home">
    <div class="goods_list">

      <div class="goods_item" v-for="item in gwcList" :key="item.id">
          <img :src="item.pic" alt="">
          <p>{{item.name}}</p>
          <p>{{item.minPrice}}</p>
          <p>数量{{item.num}}</p>
          <p>是否购物{{item.buy}}</p>
          <button @click="add( item )">加入购物车</button>
      </div>

  
    </div>


  </div>
</template>

<script>
import {mapState} from "vuex"
export default {
  computed:{
    ...mapState(['gwcList'])
  },
  beforeRouteEnter(to,form ,next){
    if(1==2){
      next()
    }else{
      next("/info")
    }
  }

 
}
</script>


<style  scoped>
  .goods_list{
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    text-align: center;
  }
  .goods_item{
    width: 30vw;
  }
  .goods_item >img{
    width: 300px;
    height: 300px;
  }
</style>